home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Mathematics / Notebooks / SigProc2.0 / Packages / SignalProcessing / Analog / LSupport.m < prev   
Encoding:
Text File  |  1992-08-18  |  5.8 KB  |  208 lines

  1. (*  :Title:    LaPlace Transform Supporting Routines  *)
  2.  
  3. (*  :Authors:    Brian Evans, James McClellan  *)
  4.  
  5. (*  :Summary:    *)
  6.  
  7. (*  :Context:    SignalProcessing`Analog`LSupport`  *)
  8.  
  9. (*  :PackageVersion:  2.7    *)
  10.  
  11. (*
  12.     :Copyright:    Copyright 1990-1991 by Brian L. Evans
  13.         Georgia Tech Research Corporation
  14.  
  15.     Permission to use, copy, modify, and distribute this software
  16.     and its documentation for any purpose and without fee is
  17.     hereby granted, provided that the above copyright notice
  18.     appear in all copies and that both that copyright notice and
  19.     this permission notice appear in supporting documentation,
  20.     and that the name of the Georgia Tech Research Corporation,
  21.     Georgia Tech, or Georgia Institute of Technology not be used
  22.     in advertising or publicity pertaining to distribution of the
  23.     software without specific, written prior permission.  Georgia
  24.     Tech makes no representations about the suitability of this
  25.     software for any purpose.  It is provided "as is" without
  26.     express or implied warranty.
  27.  *)
  28.  
  29. (*  :History:    began --  February, 1990 (adapted from "ZSupport.m")    *)
  30.  
  31. (*  :Keywords:    Laplace transform, region of convergence    *)
  32.  
  33. (*  :Source:    *)
  34.  
  35. (*  :Warning:    *)
  36.  
  37. (*  :Mathematica Version:  1.2 or 2.0  *)
  38.  
  39. (*  :Limitation:  *)
  40.  
  41. (*  :Discussion:  *)
  42.  
  43. (*
  44.     :Functions:    InvalidLTransformQ
  45.         InvalidInvLTransformQ
  46.         LForm
  47.         LMultiDROC
  48.         LTransformQ
  49.         MakeLObject
  50.  *)
  51.  
  52.  
  53.  
  54. (*  B E G I N     P A C K A G E  *)
  55.  
  56. BeginPackage[ "SignalProcessing`Analog`LSupport`",
  57.           "SignalProcessing`Support`TransSupport`",
  58.           "SignalProcessing`Support`ROC`",
  59.           "SignalProcessing`Support`SigProc`",
  60.           "SignalProcessing`Support`SupCode`" ]
  61.  
  62.  
  63. If [ TrueQ[ $VersionNumber >= 2.0 ],
  64.      Off[ General::spell ];
  65.      Off[ General::spell1 ] ];
  66.  
  67.  
  68. (*  U S A G E     I N F O R M A T I O N  *)
  69.  
  70. InvalidLTransformQ::usage =
  71.     "InvalidLTransformQ[trans] returns True if the forward Laplace \
  72.     transform rule base did not successfully finish the transform."
  73.  
  74. InvalidInvLTransformQ::usage =
  75.     "InvalidInvLTransformQ[trans] returns True if the inverse Laplace \
  76.     transform rule base did not successfully finish the transform."
  77.  
  78. LForm::usage =
  79.     "LForm[transform] returns True if the transform is a valid \
  80.     Laplace transform with a head of Transform or List."
  81.  
  82. LMultiDROC::usage =
  83.     "LMultiDROC[old-Laplace-transform, new-Laplace-transform] \
  84.     combines the transform functions, regions of convergence, and \
  85.     the transform variables in order to produce a multidimensional \
  86.     transform."
  87.  
  88. LTransformQ::usage =
  89.     "LTransformQ[x] returns True if the datum x is of the form \
  90.     LTransData[X, rm, rp, s], where X is the LaPlace transform, \
  91.     rm is the Rminus component of the region of convergence, \
  92.     rp is the Rplus component of the region of convergence, and \
  93.     s is the variable(s) in the LaPlace transform."
  94.  
  95. MakeLObject::usage =
  96.     "MakeLObject[l] and MakeLObject[l, slist] convert the LaPlace \
  97.     transform information in list l into the standard object form \
  98.     LTransData[x, Rminus[rm], Rplus[rp], LVariables[slist]]. \
  99.     Here x is the LaPlace transform, rm is the lower bound on the \
  100.     strip of convergence, rp is the upper bound on the strip of \
  101.     convergence, and slist is the list of LaPlace variables used \
  102.     in the transform."
  103.  
  104. (*  E N D     U S A G E     I N F O R M A T I O N  *)
  105.  
  106.  
  107. Begin["`Private`"]
  108.  
  109.  
  110. (*  E X T E N D     B U I L T - I N     R O U T I N E S  *)
  111.  
  112. (*  Denominator  *)
  113. LTransData/: Denominator[LTransData[fun_, a__]] := Denominator[fun]
  114.  
  115. (*  Expand  *)
  116. LTransData/: Expand[LTransData[fun_, a__]] := LTransData[Expand[fun], a]
  117.  
  118. (*  Factor  *)
  119. LTransData/: Factor[LTransData[fun_, a__]] := LTransData[Factor[fun], a]
  120.  
  121. (*  Numerator  *)
  122. LTransData/: Numerator[LTransData[fun_, a__]] := Numerator[fun]
  123.  
  124. (*  Together  *)
  125. LTransData/: Together[LTransData[fun_, a__]] := LTransData[Together[fun], a]
  126.  
  127.  
  128. (*  R E G I O N     O F     C O N V E R G E N C E  *)
  129.  
  130. (*  LMultiDROC  *)
  131. LMultiDROC[lexpr_?LTransformQ, oldl_?LTransformQ] :=
  132.     MakeLObject[ {    TheFunction[lexpr],
  133.             Append[ ToList[ GetRMinus[oldl]  ], GetRMinus[lexpr] ],
  134.             Append[ ToList[ GetRPlus[oldl]   ], GetRPlus[lexpr] ] },
  135.              Append[ ToList[LVariables[oldl]], LVariables[lexpr] ] ]
  136.  
  137.  
  138. (*  O T H E R     S U P P O R T I N G     R O U T I N E S  *)
  139.  
  140. (*  InvalidLTransformQ  *)
  141. invalidl[x_] := If [ SameQ[Head[x], head], flag = True ];
  142. InvalidLTransformQ[x_] :=
  143.     Block [    {},
  144.         head = SignalProcessing`Analog`LaPlace`Private`MyLaPlace;
  145.         Scan[invalidl, x, Infinity];
  146.         flag ]
  147.  
  148. (*  InvalidInvLTransformQ  *)
  149. invalidinvl[x_] := If [ SameQ[Head[x], head], flag = True ];
  150. InvalidInvLTransformQ[x_] :=
  151.     Block [    {},
  152.         head = SignalProcessing`Analog`InvLaPlace`Private`MyInvLaPlace;
  153.         Scan[invalidl, x, Infinity];
  154.         flag ]
  155.  
  156. (*  LForm  *)
  157. LForm[Transform[x_, rm_, rp_]] := True
  158. LForm[List[x_, rm_, rp_]] := True
  159.  
  160. (*  LTransformQ  *)
  161. LTransformQ[x_] := SameQ[Head[x], LTransData]
  162.  
  163. (*  LVariables  *)
  164. LTransData/: LVariables[LTransData[f_, rm_, rp_, s_]] := LVariables[s]
  165. LVariables[LVariables[s_]] := s
  166.  
  167. (*  MakeLObject  *)
  168. MakeLObject[LTransData[x_, rm_, rp_, s_]] :=
  169.     LTransData[x, rm, Rplus[ GetRPlus[rp] ], s]
  170. MakeLObject[x_List] :=
  171.     LTransData[ x[[1]], Rminus[ x[[2]] ], Rplus[ InfCheck[x[[3]]] ] ]
  172. MakeLObject[x_, s_] :=
  173.     LTransData[ x[[1]], Rminus[ x[[2]] ],
  174.             Rplus[ InfCheck[x[[3]]] ], LVariables[ s ] ] /;
  175.     LForm[x]
  176.  
  177. Format[ MakeLObject[a__] ] := "-Incomplete Laplace Transform-"
  178.  
  179. (*  TheFunction  *)
  180. LTransData/: TheFunction[LTransData[x_, rm_, rp_, rest___]] := x
  181.  
  182.  
  183. (*  E N D     P A C K A G E  *)
  184.  
  185. End[]
  186. EndPackage[]
  187.  
  188. If [ TrueQ[ $VersionNumber >= 2.0 ],
  189.      On[ General::spell ];
  190.      On[ General::spell1 ] ];
  191.  
  192.  
  193. (*  H E L P     I N F O R M A T I O N  *)
  194.  
  195. Block [    {newfuns},
  196.     newfuns =
  197.       { InvalidLTransformQ,    InvalidInvLTransformQ,    LForm,
  198.         LMultiDROC,        LTransformQ,        LVariables,
  199.         MakeLObject };
  200.     Combine[ SPfunctions, newfuns ];
  201.     Apply[ Protect, newfuns ] ]
  202.  
  203.  
  204. (*  E N D I N G     M E S S A G E  *)
  205.  
  206. Print[ "Supporting routines and objects for the Laplace transform are loaded." ]
  207. Null
  208.